package com.ourteam.product.model.api;

import org.apache.commons.lang3.StringUtils;

import com.ourteam.frame.web.AbstractSearchModel;
import com.ourteam.product.model.dao.ProductDatabaseDataTypeMapDAOQueryBean;
import com.ourteam.product.model.domain.ProductDatabaseDataTypeMapBean;

public class ProductDataTypeMapSearchModel extends AbstractSearchModel<ProductDatabaseDataTypeMapDAOQueryBean> {

	private String dataType;
	
	private String mappedDataType;
	
	@Override
	public String getMappedDAOField(String aProperty) {
		return ProductDatabaseDataTypeMapBean.getMappedDAOField(aProperty);
	}

	@Override
	protected void doBuildQueryBean(ProductDatabaseDataTypeMapDAOQueryBean queryBean) throws Exception {

		ProductDatabaseDataTypeMapDAOQueryBean.Criteria criteria = queryBean.createCriteria();
		
		if(StringUtils.isNotBlank(dataType)){
			criteria.andDataTypeLike(dataType);
		}
		
		if(StringUtils.isNotBlank(mappedDataType)){
			criteria.andMappedDataTypeLike(mappedDataType);
		}
	}

	public String getDataType() {
		return dataType;
	}

	public void setDataType(String dataType) {
		this.dataType = dataType;
	}

	public String getMappedDataType() {
		return mappedDataType;
	}

	public void setMappedDataType(String mappedDataType) {
		this.mappedDataType = mappedDataType;
	}
	
	

}
